try {
{{!-- START: 操作确认 --}}
{{#and appDEUIAction.enableConfirm appDEUIAction.confirmMsg}}
	const confirmResult = await new Promise<boolean>((resolve: Function) => {
		App.getDialogHelper().confirm('警告', `{{appDEUIAction.confirmMsg}}`, () => resolve(true), () => resolve(false));
	});
	if (!confirmResult) {
		return { ok: false, data: [] };
	}
{{/and}}
{{!-- END: 操作确认 --}}
{{#if appDEUIAction.frontPSAppView}}
  // 根据视图名称 获取视图详情
  const view = App.getAppViewConfig()['{{appDEUIAction.frontPSAppView.codeName}}'];
	if (!view) {
		App.getNotificationHelper().warning('', '目标视图不存在');
		return { ok: false, data: [] };
	}
	// 打开选择视图
	const actionResult = await App.getOpenViewHelper().openPage(view, context, viewParams);
	if (actionResult && actionResult.ok) {
		if (data && data.length > 0) {
			data.forEach((item: IParam) => {
				Object.assign(item, { srfactionparam: actionResult.data });
			});
		}
	}
{{/if}}
	if (ability && hasFunction(ability, 'validate')) {
		//	校验(暂时只考虑表格与表单)
		if (!(await (ability as any).validate())) {
			//	提示信息待确认
			return { ok: false, data: [] };
		}
	}
	//  获取实体服务
	const dataService = await App.getDataService('{{appEntity.codeName}}', context);
	if (context.srfsessionid) {
		Object.assign(context, { srfsessionkey: context.srfsessionid });
		delete context.srfsessionid;
	}
	{{!-- TODO 开启加载效果 --}}
{{#eq appDEUIAction.actionTarget 'MULTIKEY'}}
	const promiseArray: Promise<IHttpResponse>[] = [];
	if (data && data.length > 0) {
		const srfkeys = context['{{lowerCase appEntity.codeName}}'] ? context['{{lowerCase appEntity.codeName}}'].split(',') : [];
		data.forEach((item: IParam, index: number) => {
			const tempContext = deepCopy(context);
			Object.assign(tempContext, { {{lowerCase appEntity.codeName}}: srfkeys[index] });
			promiseArray.push(dataService['{{appDEUIAction.psAppDEMethod.codeName}}'](tempContext, item));
		})
	}
	const response = await Promise.all(promiseArray);
	if (!response) {
		return { ok: false, data: [] };
	}
	const resultData: IParam[] = [];
	if (response.length > 0) {
		response.forEach((item: IHttpResponse) => {
			resultData.push(item.data);
		})
	};
	{{!-- TODO 结束加载效果 --}}
	{{#if appDEUIAction.showBusyIndicator}}
	App.getNotificationHelper().success('成功', '{{appDEUIAction.successMsg}}');
	{{/if}}
	return await this.afterAction(context, viewParams, resultData, event, ability, actionModel);
{{else}}
	const response: IHttpResponse = await dataService['{{appDEUIAction.psAppDEMethod.codeName}}'](context, viewParams);
	if (!response.success) {
		return { ok: false, data: [] };
	}
	{{#and appDEUIAction.customCode (eq appDEUIAction.psAppDEMethod.psDEServiceAPIMethod null)}}
	Object.assign(data[0], response.data);
	{{/and}}
	{{!-- TODO 结束加载效果 --}}
	{{#if appDEUIAction.showBusyIndicator}}
	App.getNotificationHelper().success('成功', '{{appDEUIAction.successMsg}}');
	{{/if}}
	return await this.afterAction(context, viewParams, response.data, event, ability, actionModel);
{{/eq}}
} catch (error: any) {
  return { ok: false, data: error };
}
